Skip to content

Remove < Python 3.6 compatibility code - #3988

Closed
kamyar wants to merge 4 commits into
python-poetry:masterfrom
kamyar:master
Closed

kamyar wants to merge 4 commits into
python-poetry:masterfrom
kamyar:master

Conversation

@kamyar

@kamyar kamyar commented Apr 22, 2021 •

Copy link
Copy Markdown
Contributor

Hey, I saw the issue linked below and immediately thought of pyupgrade and as poetry already uses pre-commit added the config for it with target set to python 3.6.

I know the issue says "please keep the pull requests small and modular." but as the changes are autogenerated and rather simple(in terms of mental focus needed to review) I thought might be ok to submit them together.

Please let me know if multiple small PRs is still preferred, I will open related syntax updates together (either by file/directory or by type of change)

I already went through all changes twice and did not notice anything that would change the behaviour.
Also please let me know if there is something missing.

p.s. thank you for such a great tool, it has been a true delight to use it both at work and personal project. :)

p.p.s. below are some suggested extra changes that convert f"{foo}" to foo, if they look good I will create a single commit with the fixes rather than creating one commit per suggestion.

Pull Request Check List

Resolves: #3860

  • Added tests for changed code. (Not Needed?)
  • Updated documentation for changed code. (Not Needed?)

Comment thread poetry/console/commands/version.py Resolved
Comment thread poetry/console/commands/version.py Resolved
Comment thread tests/console/commands/test_add.py Resolved
Comment thread tests/console/commands/test_add.py Resolved
Comment thread tests/console/commands/test_add.py Resolved
Comment thread tests/console/commands/test_add.py Resolved
Comment thread tests/console/commands/test_add.py Resolved
Comment thread tests/console/commands/test_add.py Resolved
Comment thread tests/console/commands/test_init.py Resolved
@kamyar
kamyar requested a review from abn May 1, 2021 16:55
@kamyar
kamyar force-pushed the master branch 2 times, most recently from b2034d6 to 7e4d02a Compare May 8, 2021 21:36
Co-authored-by: Kamyar Ghasemlou <github@kamy.me>
Co-authored-by: Harry Peach <harrypeach1999@gmail.com>
@kamyar
kamyar force-pushed the master branch 2 times, most recently from 25de732 to 6f34b77 Compare May 8, 2021 22:25
kamyar and others added 2 commits May 9, 2021 00:27
Co-authored-by: Kamyar Ghasemlou <github@kamy.me>
Co-authored-by: Harry Peach <harrypeach1999@gmail.com>
Co-authored-by: Kamyar Ghasemlou <github@kamy.me>
Co-authored-by: Harry Peach <harrypeach1999@gmail.com>
@danieleades

Copy link
Copy Markdown
Contributor

worth also removing

# this is required to handle pathlib oddity on win32 python==3.5
in this pull request?

@kamyar

kamyar commented May 10, 2021

Copy link
Copy Markdown
Contributor Author

@danieleades I don't have context on how to improve that but happy to help, do you have any suggestions?

@danieleades

Copy link
Copy Markdown
Contributor

@danieleades I don't have context on how to improve that but happy to help, do you have any suggestions?

My suggestion is to remove the try/except entirely. If the comment is to be believed, it's only required for python 3.5, which isn't supported anyway

@kamyar

kamyar commented May 10, 2021

Copy link
Copy Markdown
Contributor Author

Sounds good, will give it a try by replacing the try/except with path = lib.joinpath(path).resolve().
cc @abn fyi hope this is compatible with the scope of the original issue. :)

Co-authored-by: Kamyar Ghasemlou <github@kamy.me>
Co-authored-by: Harry Peach <harrypeach1999@gmail.com>
@kamyar

kamyar commented May 13, 2021

Copy link
Copy Markdown
Contributor Author

@abn can you take a look and allow the workflow runs? :)
I think the PR is ready, thank you

Comment thread get-poetry.py

try:
r = urlopen(url + "{}".format(checksum))
r = urlopen(url + f"{checksum}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this concatenation be like that?

Suggested change
r = urlopen(url + f"{checksum}")
r = urlopen(f"{url}{checksum}")

Comment thread get-poetry.py

try:
r = urlopen(url + "{}".format(name))
r = urlopen(url + f"{name}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too

Suggested change
r = urlopen(url + f"{name}")
r = urlopen(f"{url}{name}")

self.line(f"{self.poetry.package.pretty_version}")
else:
self.line(
"<comment>{}</> <info>{}</>".format(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's necessary to change this excerpt.

Comment thread sonnet
base_name = "poetry-{}-{}".format(__version__, sys.platform)
name = "{}.tar.gz".format(base_name)
base_name = f"poetry-{__version__}-{sys.platform}"
name = f"{base_name}.tar.gz"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about unifying this string into one?

Obs.: if you accept, don't forget to change the lines that use the string name

Suggested change
name = f"{base_name}.tar.gz"
base_name = f"poetry-{__version__}-{sys.platform}.tar.gz"

expected = "Deleted virtualenv: {}\n".format(
(venv_cache / "{}-py3.6".format(venv_name))
)
expected = "Deleted virtualenv: {}\n".format(venv_cache / f"{venv_name}-py3.6")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
expected = "Deleted virtualenv: {}\n".format(venv_cache / f"{venv_name}-py3.6")
expected = f"Deleted virtualenv: {venv_cache / venv_name}-py3.6\n"

@danieleades

Copy link
Copy Markdown
Contributor

is this pull request still alive?

@HarryPeach

Copy link
Copy Markdown
Contributor

is this pull request still alive?

I hope so, would be nice to get the code merged as it seems ready.

@abn Is there anything that needs changing on this before the workflows can be run? Would be happy to contribute some more to get this over the line

neersighted added a commit that referenced this pull request Nov 15, 2021
Implements the reviews from #3987 and #3988. Special thanks to the
committers and reviewers there.

Co-authored-by: Harry Peach <harrypeach1999@gmail.com>
Co-authored-by: Kamyar Ghasemlou <kamyar@kamy.me>
Co-authored-by: Leonardo Freua <leonardo.batista.freua@gmail.com>
@neersighted

Copy link
Copy Markdown
Member

I'm closing this in favor of #4758 as it uses the current pre-commit structure, skips files that should not be altered by pyupgrade (get-poetry.py and install-poetry.py), and because there have been enough changes to master that a new run is needed.

Thank you for the work on these PRs! I've incorporated the changes from review into my version, and given credit where due. Please submit more PRs cleaning out old code/cruft when you can!

neersighted added a commit that referenced this pull request Nov 15, 2021
Implements the reviews from #3987 and #3988. Special thanks to the
committers and reviewers there.

Co-authored-by: Harry Peach <harrypeach1999@gmail.com>
Co-authored-by: Kamyar Ghasemlou <kamyar@kamy.me>
Co-authored-by: Leonardo Freua <leonardo.batista.freua@gmail.com>
neersighted added a commit that referenced this pull request Nov 15, 2021
Implements the reviews from #3987 and #3988. Special thanks to the
committers and reviewers there.

Co-authored-by: Harry Peach <harrypeach1999@gmail.com>
Co-authored-by: Kamyar Ghasemlou <kamyar@kamy.me>
Co-authored-by: Leonardo Freua <leonardo.batista.freua@gmail.com>
neersighted added a commit that referenced this pull request Nov 15, 2021
Implements the reviews from #3987 and #3988. Special thanks to the
committers and reviewers there.

Co-authored-by: Harry Peach <harrypeach1999@gmail.com>
Co-authored-by: Kamyar Ghasemlou <kamyar@kamy.me>
Co-authored-by: Leonardo Freua <leonardo.batista.freua@gmail.com>
neersighted added a commit that referenced this pull request Nov 15, 2021
Implements the reviews from #3987 and #3988. Special thanks to the
committers and reviewers there.

Co-authored-by: Harry Peach <harrypeach1999@gmail.com>
Co-authored-by: Kamyar Ghasemlou <kamyar@kamy.me>
Co-authored-by: Leonardo Freua <leonardo.batista.freua@gmail.com>
neersighted added a commit that referenced this pull request Nov 15, 2021
Implements the reviews from #3987 and #3988. Special thanks to the
committers and reviewers there.

Co-authored-by: Harry Peach <harrypeach1999@gmail.com>
Co-authored-by: Kamyar Ghasemlou <kamyar@kamy.me>
Co-authored-by: Leonardo Freua <leonardo.batista.freua@gmail.com>
neersighted added a commit that referenced this pull request Nov 15, 2021
Implements the reviews from #3987 and #3988. Special thanks to the
committers and reviewers there.

Co-authored-by: Harry Peach <harrypeach1999@gmail.com>
Co-authored-by: Kamyar Ghasemlou <kamyar@kamy.me>
Co-authored-by: Leonardo Freua <leonardo.batista.freua@gmail.com>
neersighted added a commit that referenced this pull request Nov 16, 2021
Implements the reviews from #3987 and #3988. Special thanks to the
committers and reviewers there.

Co-authored-by: Harry Peach <harrypeach1999@gmail.com>
Co-authored-by: Kamyar Ghasemlou <kamyar@kamy.me>
Co-authored-by: Leonardo Freua <leonardo.batista.freua@gmail.com>
neersighted added a commit that referenced this pull request Nov 16, 2021
Implements the reviews from #3987 and #3988. Special thanks to the
committers and reviewers there.

Co-authored-by: Harry Peach <harrypeach1999@gmail.com>
Co-authored-by: Kamyar Ghasemlou <kamyar@kamy.me>
Co-authored-by: Leonardo Freua <leonardo.batista.freua@gmail.com>
neersighted added a commit that referenced this pull request Nov 17, 2021
Implements the reviews from #3987 and #3988. Special thanks to the
committers and reviewers there.

Co-authored-by: Harry Peach <harrypeach1999@gmail.com>
Co-authored-by: Kamyar Ghasemlou <kamyar@kamy.me>
Co-authored-by: Leonardo Freua <leonardo.batista.freua@gmail.com>
neersighted added a commit that referenced this pull request Nov 17, 2021
Implements the reviews from #3987 and #3988. Special thanks to the
committers and reviewers there.

Co-authored-by: Harry Peach <harrypeach1999@gmail.com>
Co-authored-by: Kamyar Ghasemlou <kamyar@kamy.me>
Co-authored-by: Leonardo Freua <leonardo.batista.freua@gmail.com>
@github-actions

Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🧹 Remove compatibility code: Python < 3.6

6 participants